import axios from 'axios';

// 列表分页
export const getCatalogue = (data) =>
  axios.request({
    url: '/api/v1/event/catalogue/page',
    method: 'get',
    params: data
  });
//不分层级全部检索
export const getCatalogueSearch = (data) =>
  axios.request({
    url: '/api/v1/event/catalogue/page/search',
    method: 'get',
    params: data
  });
//双击 按层级分页
export const getCatalogueHome = (data) =>
  axios.request({
    url: '/api/v1/event/catalogue/home',
    method: 'get',
    params: data
  });
// 提交审核
export const approval = (params) =>
  axios.request({
    url: '/api/v1/event/catalogue/stateApproval/' + params.ecId,
    method: 'get',
    params: {
      reason: params.reason
    }
  });
// 审核通过
export const approved = (ecId) =>
  axios.request({
    url: '/api/v1/event/catalogue/approved/' + ecId,
    method: 'get'
  });
// 批量提交审核
export const batchAudit = (ecIds) =>
  axios.request({
    url: '/api/v1/event/catalogue/batchAudit/' + ecIds,
    method: 'get'
  });

// 失效
export const invalid = (params) =>
  axios.request({
    url: '/api/v1/event/catalogue/invalid/' + params.ecId,
    method: 'get',
    params: {
      reason: params.reason
    }
  });
// 生效
export const takeEffect = (params) =>
  axios.request({
    url: '/api/v1/event/catalogue/takeEffect',
    method: 'get',
    params: params
  });
// 合并
export const merge = (data) =>
  axios.request({
    url: '/api/v1/event/catalogue/merge',
    method: 'get',
    params: data
  });
// 批量删除
export const batchDel = (ecIds) =>
  axios.request({
    url: '/api/v1/event/catalogue/list/' + ecIds,
    method: 'delete'
  });
// 删除
export const delCatalogue = (ecId) =>
  axios.request({
    url: '/api/v1/event/catalogue/' + ecId,
    method: 'delete'
  });

// 根据行政区划编码 获取区域部门树
export const getAreaDepartTree = (areaCode, showDepart) =>
  axios.request({
    url: `/api/v1/event/areas/areaDepartTree/${areaCode}/${showDepart}`,
    method: 'get'
  });

// 查看已审批历史
export const getHistoryList = (params) =>
  axios.request({
    url: `/api/v1/event/catalogue/approvalHistory`,
    method: 'get',
    params
  });

// 查看待审批历史
export const getWaitHistoryList = (params) =>
  axios.request({
    url: `/api/v1/event/implementation-character/page/history/apply`,
    method: 'get',
    params
  });
// 新建目录
export const addCatalogue = (data) =>
  axios.request({
    url: `/api/v1/event/catalogue`,
    method: 'post',
    data: data
  });
// 新建目录
export const editCatalogue = (data) =>
  axios.request({
    url: `/api/v1/event/catalogue`,
    method: 'put',
    data: data
  });

// 获取情形关系详情
export const getSituationList = (eventId) =>
  axios.request({
    url: `/api/v1/event/situation/package/` + eventId,
    method: 'get'
  });
// 事项目录树
export const getCatalogueTree = () =>
  axios.request({
    url: '/api/v1/event/catalogue/tree',
    method: 'get'
  });
